package com.miracle.flexAPI.api.controller;

import com.miracle.flexAPI.api.entity.User;
import com.miracle.flexAPI.api.service.UserService;
import com.miracle.flexAPI.api.dto.UserDto;
import com.ruoyi.common.core.domain.AjaxResult;
import io.swagger.annotations.*;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

import javax.annotation.Resource;

@RestController
@RequestMapping("/user")
@Api(value = "takApi",tags = {"用户"})
public class UserController {

    @Resource
    UserService service;


    @GetMapping(value = "list")
    @ApiOperation(value = "查询所有的任务")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id" , value="主键-唯一标识", defaultValue = "",dataType = "Integer",paramType = "query"),
    })
    @ApiResponses({
            @ApiResponse(code=200,message =
                    "data:保存的数据\n"
            )
    })
    public AjaxResult list(@ApiIgnore UserDto dto){
        return AjaxResult.success(service.selectUser(dto));
    }


    @PostMapping(value = "add")
    @ApiOperation(value = "添加")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id" , value="主键-唯一标识", defaultValue = "",dataType = "Integer",paramType = "query"),
            @ApiImplicitParam(name = "name" , value="姓名", defaultValue = "",dataType = "string",paramType = "query"),
            @ApiImplicitParam(name = "age" , value="年龄", defaultValue = "",dataType = "string",paramType = "query"),
    })
    @ApiResponses({
            @ApiResponse(code=200,message =
                    "data:保存的数据\n"
            )
    })
    public AjaxResult insertUser(@ApiIgnore User dto){
        return AjaxResult.success(service.inserUser(dto));
    }






}
